key_down

This function checks if a particular key on the keyboard is currently being held down.

bool key_down(int key)

Parameters:
key
One of the BGT key name constants, see appendix A for a full list.

Return value:
true if the key is held down, false if it is not or if an error occurs.

Remarks:
The difference between key_down and key_pressed is that key_pressed will only return true when the user first pushes down the key, while key_down will continue returning true until the key is released again.

Example:
// Wait for the user to hold down alt and press f4 before closing the program.

void main()
{
show_game_window("Test Game");
while(true)
{
if(key_down(KEY_LMENU) && key_pressed(KEY_F4))
{
exit();
}
// Other code goes here.
wait(5);
}
}